<template>
  <div class="detail-card">
    <el-card shadow="hover">
      <div class="item" v-for="item in dataList" :key="item.id" @click="handleToChapter(item.id)">
        <div class="info">
          <div class="title">{{item.name}}</div>
          <div class="intro">{{item.intro}}</div>
          <div class="other">
            <div class="author">{{item.writer}} 著</div>
            <div class="tag">
              <span>{{item.is_over}}</span>
              <span>{{item.type}}</span>
            </div>
          </div>
        </div>
        <div class="img">
          <el-image :src="item.image" fit="fill" lazy>
            <div slot="error">
              <img src="http://foglake.sanye666.top/images/default-covor.jpg" alt />
            </div>
          </el-image>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "detailcard",
  props: {
    dataList: Array,
  },
  watch: {
    dataList(val) {
      this.dataList = val;
    },
  },
  methods: {
    handleToChapter(id) {
      this.$router.push({
        path: "/chapter",
        query: { id },
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.detail-card {
  width: 956px;
  background: rgba(255, 255, 255, 1);
  border-radius: 12px;
  cursor: pointer;
  .item {
    display: flex;
    justify-content: space-between;
    padding: 24px 24px 24px 32px;
    .info {
      text-align: left;
      width: 703px;
      .title {
        font-size: 24px;
        font-family: MicrosoftYaHeiSemibold;
        font-weight: 600;
        color: rgba(6, 27, 65, 0.65);
        line-height: 24px;
        margin: 24px 0;
      }
      .intro {
        font-size: 14px;
        font-family: MicrosoftYaHei;
        font-weight: 400;
        color: rgba(6, 27, 65, 0.45);
        line-height: 22px;
        padding-bottom: 44px;
        border-bottom: 1px solid rgba(6, 27, 65, 0.05);
        margin-bottom: 20px;
      }
      .other {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .author {
          font-size: 14px;
          font-family: MicrosoftYaHeiSemibold;
          font-weight: 600;
          color: rgba(6, 27, 65, 0.45);
          line-height: 24px;
        }
        .tag {
          span {
            font-size: 12px;
            font-family: MicrosoftYaHei;
            font-weight: 400;
            color: rgba(189, 141, 255, 1);
            line-height: 24px;
            padding: 8px 14px;
            border: 1px solid rgba(189, 141, 255, 1);
            border-radius: 20px;
            margin-right: 2px;
          }
          span:last-child {
            margin-right: 0;
            color: rgba(255, 130, 130, 1);
            border: 1px solid rgba(255, 130, 130, 1);
          }
        }
      }
    }
    .img {
    }
  }
}

.detail-card:hover {
  transform: translateY(-3px);
  transition: all 0.3s linear;
}
</style>